package com.wzy.business.room.bean

import androidx.room.ColumnInfo
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey
import androidx.room.Relation
import com.wangzhenyu.common.base.bean.LoginInfo


@Entity(tableName = "user")
data class User(
    @ColumnInfo(name = "phone")
    var phone: String,
    @ColumnInfo(name = "password")
    var password: String,
    @ColumnInfo(name = "code")
    var code: String,
    @ColumnInfo(name = "username")
    var username: String
) {
    @PrimaryKey(autoGenerate = true)
    var id: Int = 0

    //忽略字段
    @Ignore
    var time: String = ""
}

data class UserAndLoginInfo(
    @Embedded val store: User,
    @Relation(
        parentColumn = "phone",
        entityColumn = "mobile"
    )
    val loginInfo: List<LoginInfo>
)